.class public Lrexsee/natives/clazz/ListViewAdapter;
.super Landroid/widget/BaseAdapter;
.source "ListViewAdapter.java"


# instance fields
.field public final mBrowser:Lrexsee/core/browser/Browser;

.field private final mDrawablePathes:[Ljava/lang/String;

.field private final mIconBg:Landroid/graphics/drawable/Drawable;

.field private final mStyle:Lrexsee/core/style/StyleSheet;

.field private final mViews:[Landroid/view/View;


# direct methods
.method public constructor <init>(Lrexsee/core/browser/Browser;Lrexsee/natives/ViewTag;[Landroid/view/View;)V
    .locals 6
    .param p1, "browser"    # Lrexsee/core/browser/Browser;
    .param p2, "parent"    # Lrexsee/natives/ViewTag;
    .param p3, "options"    # [Landroid/view/View;

    .prologue
    const/4 v5, -0x1

    const/4 v3, 0x0

    .line 35
    invoke-direct {p0}, Landroid/widget/BaseAdapter;-><init>()V

    .line 36
    iput-object p1, p0, Lrexsee/natives/clazz/ListViewAdapter;->mBrowser:Lrexsee/core/browser/Browser;

    .line 37
    iput-object v3, p0, Lrexsee/natives/clazz/ListViewAdapter;->mDrawablePathes:[Ljava/lang/String;

    .line 38
    iput-object v3, p0, Lrexsee/natives/clazz/ListViewAdapter;->mIconBg:Landroid/graphics/drawable/Drawable;

    .line 39
    iput-object v3, p0, Lrexsee/natives/clazz/ListViewAdapter;->mStyle:Lrexsee/core/style/StyleSheet;

    .line 40
    array-length v3, p3

    new-array v3, v3, [Landroid/view/View;

    iput-object v3, p0, Lrexsee/natives/clazz/ListViewAdapter;->mViews:[Landroid/view/View;

    .line 41
    const/4 v0, 0x0

    .local v0, "i":I
    :goto_0
    array-length v3, p3

    if-lt v0, v3, :cond_0

    .line 52
    return-void

    .line 42
    :cond_0
    iget-object v3, p0, Lrexsee/natives/clazz/ListViewAdapter;->mViews:[Landroid/view/View;

    aget-object v4, p3, v0

    aput-object v4, v3, v0

    .line 44
    iget-object v3, p0, Lrexsee/natives/clazz/ListViewAdapter;->mViews:[Landroid/view/View;

    aget-object v3, v3, v0

    invoke-virtual {v3}, Landroid/view/View;->getTag()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lrexsee/natives/ViewTag;

    .line 45
    .local v2, "tag":Lrexsee/natives/ViewTag;
    if-eqz v2, :cond_1

    .line 46
    new-instance v1, Landroid/widget/FrameLayout$LayoutParams;

    iget-object v3, v2, Lrexsee/natives/ViewTag;->style:Lrexsee/core/style/StyleSheet;

    invoke-virtual {v3}, Lrexsee/core/style/StyleSheet;->getWidth()I

    move-result v3

    iget-object v4, v2, Lrexsee/natives/ViewTag;->style:Lrexsee/core/style/StyleSheet;

    invoke-virtual {v4}, Lrexsee/core/style/StyleSheet;->getHeight()I

    move-result v4

    invoke-direct {v1, v3, v4}, Landroid/widget/FrameLayout$LayoutParams;-><init>(II)V

    .line 50
    .local v1, "layoutParams":Landroid/widget/FrameLayout$LayoutParams;
    :goto_1
    iget-object v3, p0, Lrexsee/natives/clazz/ListViewAdapter;->mViews:[Landroid/view/View;

    aget-object v3, v3, v0

    invoke-virtual {v3, v1}, Landroid/view/View;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 41
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    .line 48
    .end local v1    # "layoutParams":Landroid/widget/FrameLayout$LayoutParams;
    :cond_1
    new-instance v1, Landroid/widget/FrameLayout$LayoutParams;

    invoke-direct {v1, v5, v5}, Landroid/widget/FrameLayout$LayoutParams;-><init>(II)V

    .restart local v1    # "layoutParams":Landroid/widget/FrameLayout$LayoutParams;
    goto :goto_1
.end method

.method public constructor <init>(Lrexsee/core/browser/Browser;Lrexsee/natives/ViewTag;[Ljava/lang/String;)V
    .locals 2
    .param p1, "browser"    # Lrexsee/core/browser/Browser;
    .param p2, "parent"    # Lrexsee/natives/ViewTag;
    .param p3, "options"    # [Ljava/lang/String;

    .prologue
    .line 28
    invoke-direct {p0}, Landroid/widget/BaseAdapter;-><init>()V

    .line 29
    iput-object p1, p0, Lrexsee/natives/clazz/ListViewAdapter;->mBrowser:Lrexsee/core/browser/Browser;

    .line 30
    iput-object p3, p0, Lrexsee/natives/clazz/ListViewAdapter;->mDrawablePathes:[Ljava/lang/String;

    .line 31
    array-length v0, p3

    new-array v0, v0, [Landroid/view/View;

    iput-object v0, p0, Lrexsee/natives/clazz/ListViewAdapter;->mViews:[Landroid/view/View;

    .line 32
    iget-object v0, p2, Lrexsee/natives/ViewTag;->style:Lrexsee/core/style/StyleSheet;

    iput-object v0, p0, Lrexsee/natives/clazz/ListViewAdapter;->mStyle:Lrexsee/core/style/StyleSheet;

    .line 33
    iget-object v0, p2, Lrexsee/natives/ViewTag;->style:Lrexsee/core/style/StyleSheet;

    iget-object v0, v0, Lrexsee/core/style/StyleSheet;->icon_background_color:Ljava/lang/String;

    const/4 v1, 0x0

    invoke-static {p1, v0, v1}, Lrexsee/core/style/RexseeDrawable;->getDrawable(Lrexsee/core/browser/Browser;Ljava/lang/String;Landroid/graphics/drawable/Drawable;)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    iput-object v0, p0, Lrexsee/natives/clazz/ListViewAdapter;->mIconBg:Landroid/graphics/drawable/Drawable;

    .line 34
    return-void
.end method

.method private createImageView(Ljava/lang/String;)Landroid/widget/ImageView;
    .locals 12
    .param p1, "path"    # Ljava/lang/String;

    .prologue
    const/4 v11, 0x0

    .line 56
    :try_start_0
    new-instance v5, Landroid/widget/ImageView;

    iget-object v7, p0, Lrexsee/natives/clazz/ListViewAdapter;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {v7}, Lrexsee/core/browser/Browser;->getContext()Landroid/content/Context;

    move-result-object v7

    invoke-direct {v5, v7}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;)V

    .line 57
    .local v5, "imageView":Landroid/widget/ImageView;
    iget-object v7, p0, Lrexsee/natives/clazz/ListViewAdapter;->mStyle:Lrexsee/core/style/StyleSheet;

    invoke-virtual {v7}, Lrexsee/core/style/StyleSheet;->getIconLayoutParams()Landroid/widget/LinearLayout$LayoutParams;

    move-result-object v7

    invoke-virtual {v5, v7}, Landroid/widget/ImageView;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 58
    iget-object v7, p0, Lrexsee/natives/clazz/ListViewAdapter;->mStyle:Lrexsee/core/style/StyleSheet;

    invoke-virtual {v7}, Lrexsee/core/style/StyleSheet;->getIconPaddingLeft()I

    move-result v7

    iget-object v8, p0, Lrexsee/natives/clazz/ListViewAdapter;->mStyle:Lrexsee/core/style/StyleSheet;

    invoke-virtual {v8}, Lrexsee/core/style/StyleSheet;->getIconPaddingTop()I

    move-result v8

    iget-object v9, p0, Lrexsee/natives/clazz/ListViewAdapter;->mStyle:Lrexsee/core/style/StyleSheet;

    invoke-virtual {v9}, Lrexsee/core/style/StyleSheet;->getIconPaddingRight()I

    move-result v9

    iget-object v10, p0, Lrexsee/natives/clazz/ListViewAdapter;->mStyle:Lrexsee/core/style/StyleSheet;

    invoke-virtual {v10}, Lrexsee/core/style/StyleSheet;->getIconPaddingBottom()I

    move-result v10

    invoke-virtual {v5, v7, v8, v9, v10}, Landroid/widget/ImageView;->setPadding(IIII)V

    .line 59
    iget-object v7, p0, Lrexsee/natives/clazz/ListViewAdapter;->mIconBg:Landroid/graphics/drawable/Drawable;

    if-eqz v7, :cond_0

    iget-object v7, p0, Lrexsee/natives/clazz/ListViewAdapter;->mIconBg:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v5, v7}, Landroid/widget/ImageView;->setBackgroundDrawable(Landroid/graphics/drawable/Drawable;)V

    .line 60
    :cond_0
    iget-object v7, p0, Lrexsee/natives/clazz/ListViewAdapter;->mStyle:Lrexsee/core/style/StyleSheet;

    invoke-virtual {v7}, Lrexsee/core/style/StyleSheet;->getIconAlpha()I

    move-result v7

    invoke-virtual {v5, v7}, Landroid/widget/ImageView;->setAlpha(I)V

    .line 61
    iget-object v7, p0, Lrexsee/natives/clazz/ListViewAdapter;->mStyle:Lrexsee/core/style/StyleSheet;

    invoke-virtual {v7}, Lrexsee/core/style/StyleSheet;->getIconScaleType()Landroid/widget/ImageView$ScaleType;

    move-result-object v7

    invoke-virtual {v5, v7}, Landroid/widget/ImageView;->setScaleType(Landroid/widget/ImageView$ScaleType;)V

    .line 63
    iget-object v7, p0, Lrexsee/natives/clazz/ListViewAdapter;->mStyle:Lrexsee/core/style/StyleSheet;

    iget-object v7, v7, Lrexsee/core/style/StyleSheet;->icon_bounds:Ljava/lang/String;

    const/4 v8, -0x1

    invoke-static {v7, v8}, Lrexsee/core/utilities/Utilities;->getInt(Ljava/lang/String;I)I

    move-result v1

    .line 64
    .local v1, "bounds":I
    if-lez v1, :cond_2

    .line 65
    new-instance v4, Ljava/io/File;

    invoke-static {p1}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v7

    invoke-virtual {v7}, Landroid/net/Uri;->getSchemeSpecificPart()Ljava/lang/String;

    move-result-object v7

    invoke-direct {v4, v7}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 66
    .local v4, "file":Ljava/io/File;
    if-eqz v4, :cond_1

    invoke-virtual {v4}, Ljava/io/File;->isFile()Z

    move-result v7

    if-eqz v7, :cond_1

    invoke-virtual {v4}, Ljava/io/File;->canRead()Z

    move-result v7

    if-eqz v7, :cond_1

    .line 68
    new-instance v6, Landroid/graphics/BitmapFactory$Options;

    invoke-direct {v6}, Landroid/graphics/BitmapFactory$Options;-><init>()V

    .line 69
    .local v6, "options":Landroid/graphics/BitmapFactory$Options;
    const/4 v7, 0x1

    iput-boolean v7, v6, Landroid/graphics/BitmapFactory$Options;->inJustDecodeBounds:Z

    .line 70
    invoke-virtual {v4}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object v7

    invoke-static {v7, v6}, Landroid/graphics/BitmapFactory;->decodeFile(Ljava/lang/String;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;

    move-result-object v0

    .line 71
    .local v0, "bitmap":Landroid/graphics/Bitmap;
    const/4 v7, 0x0

    iput-boolean v7, v6, Landroid/graphics/BitmapFactory$Options;->inJustDecodeBounds:Z

    .line 72
    const/4 v7, 0x1

    iget v8, v6, Landroid/graphics/BitmapFactory$Options;->outHeight:I

    div-int/2addr v8, v1

    iget v9, v6, Landroid/graphics/BitmapFactory$Options;->outWidth:I

    div-int/2addr v9, v1

    invoke-static {v8, v9}, Ljava/lang/Math;->max(II)I

    move-result v8

    int-to-float v8, v8

    invoke-static {v8}, Ljava/lang/Math;->round(F)I

    move-result v8

    invoke-static {v7, v8}, Ljava/lang/Math;->max(II)I

    move-result v7

    iput v7, v6, Landroid/graphics/BitmapFactory$Options;->inSampleSize:I

    .line 73
    invoke-virtual {v4}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object v7

    invoke-static {v7, v6}, Landroid/graphics/BitmapFactory;->decodeFile(Ljava/lang/String;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;

    move-result-object v0

    .line 74
    invoke-virtual {v5, v0}, Landroid/widget/ImageView;->setImageBitmap(Landroid/graphics/Bitmap;)V

    .end local v0    # "bitmap":Landroid/graphics/Bitmap;
    .end local v4    # "file":Ljava/io/File;
    .end local v6    # "options":Landroid/graphics/BitmapFactory$Options;
    :cond_1
    :goto_0
    move-object v7, v5

    .line 90
    .end local v1    # "bounds":I
    .end local v5    # "imageView":Landroid/widget/ImageView;
    :goto_1
    return-object v7

    .line 77
    .restart local v1    # "bounds":I
    .restart local v5    # "imageView":Landroid/widget/ImageView;
    :cond_2
    iget-object v7, p0, Lrexsee/natives/clazz/ListViewAdapter;->mBrowser:Lrexsee/core/browser/Browser;

    const/4 v8, 0x0

    invoke-static {v7, p1, v8}, Lrexsee/core/style/RexseeDrawable;->getDrawable(Lrexsee/core/browser/Browser;Ljava/lang/String;Landroid/graphics/drawable/Drawable;)Landroid/graphics/drawable/Drawable;

    move-result-object v2

    .line 78
    .local v2, "drawable":Landroid/graphics/drawable/Drawable;
    if-eqz v2, :cond_3

    .line 79
    invoke-virtual {v5, v2}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 88
    .end local v1    # "bounds":I
    .end local v2    # "drawable":Landroid/graphics/drawable/Drawable;
    .end local v5    # "imageView":Landroid/widget/ImageView;
    :catch_0
    move-exception v7

    move-object v3, v7

    .line 89
    .local v3, "e":Ljava/lang/Exception;
    iget-object v7, p0, Lrexsee/natives/clazz/ListViewAdapter;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v7, v8, v3}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/Exception;)V

    move-object v7, v11

    .line 90
    goto :goto_1

    .line 81
    .end local v3    # "e":Ljava/lang/Exception;
    .restart local v1    # "bounds":I
    .restart local v2    # "drawable":Landroid/graphics/drawable/Drawable;
    .restart local v5    # "imageView":Landroid/widget/ImageView;
    :cond_3
    :try_start_1
    iget-object v7, p0, Lrexsee/natives/clazz/ListViewAdapter;->mStyle:Lrexsee/core/style/StyleSheet;

    iget-object v7, v7, Lrexsee/core/style/StyleSheet;->icon:Landroid/graphics/drawable/Drawable;

    if-eqz v7, :cond_1

    .line 82
    iget-object v7, p0, Lrexsee/natives/clazz/ListViewAdapter;->mStyle:Lrexsee/core/style/StyleSheet;

    iget-object v7, v7, Lrexsee/core/style/StyleSheet;->icon:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v5, v7}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    goto :goto_0
.end method


# virtual methods
.method public getCount()I
    .locals 1

    .prologue
    .line 115
    iget-object v0, p0, Lrexsee/natives/clazz/ListViewAdapter;->mViews:[Landroid/view/View;

    array-length v0, v0

    return v0
.end method

.method public getItem(I)Ljava/lang/Object;
    .locals 1
    .param p1, "position"    # I

    .prologue
    .line 119
    invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v0

    return-object v0
.end method

.method public getItemId(I)J
    .locals 2
    .param p1, "position"    # I

    .prologue
    .line 123
    int-to-long v0, p1

    return-wide v0
.end method

.method public getView(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View;
    .locals 4
    .param p1, "position"    # I
    .param p2, "convertView"    # Landroid/view/View;
    .param p3, "parent"    # Landroid/view/ViewGroup;

    .prologue
    .line 96
    if-nez p2, :cond_0

    .line 97
    new-instance p2, Landroid/widget/FrameLayout;

    .end local p2    # "convertView":Landroid/view/View;
    iget-object v3, p0, Lrexsee/natives/clazz/ListViewAdapter;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {v3}, Lrexsee/core/browser/Browser;->getContext()Landroid/content/Context;

    move-result-object v3

    invoke-direct {p2, v3}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;)V

    .line 99
    .restart local p2    # "convertView":Landroid/view/View;
    :cond_0
    move-object v0, p2

    check-cast v0, Landroid/widget/FrameLayout;

    move-object v1, v0

    .line 100
    .local v1, "frame":Landroid/widget/FrameLayout;
    iget-object v3, p0, Lrexsee/natives/clazz/ListViewAdapter;->mDrawablePathes:[Ljava/lang/String;

    if-eqz v3, :cond_1

    .line 101
    invoke-virtual {v1}, Landroid/widget/FrameLayout;->removeAllViews()V

    .line 102
    iget-object v3, p0, Lrexsee/natives/clazz/ListViewAdapter;->mDrawablePathes:[Ljava/lang/String;

    aget-object v3, v3, p1

    invoke-direct {p0, v3}, Lrexsee/natives/clazz/ListViewAdapter;->createImageView(Ljava/lang/String;)Landroid/widget/ImageView;

    move-result-object v3

    invoke-virtual {v1, v3}, Landroid/widget/FrameLayout;->addView(Landroid/view/View;)V

    .line 111
    :goto_0
    return-object v1

    .line 104
    :cond_1
    iget-object v3, p0, Lrexsee/natives/clazz/ListViewAdapter;->mViews:[Landroid/view/View;

    aget-object v3, v3, p1

    invoke-virtual {v3}, Landroid/view/View;->getParent()Landroid/view/ViewParent;

    move-result-object v2

    check-cast v2, Landroid/view/ViewGroup;

    .line 105
    .local v2, "viewParent":Landroid/view/ViewGroup;
    if-eqz v2, :cond_2

    .line 106
    invoke-virtual {v2}, Landroid/view/ViewGroup;->removeAllViews()V

    .line 108
    :cond_2
    invoke-virtual {v1}, Landroid/widget/FrameLayout;->removeAllViews()V

    .line 109
    iget-object v3, p0, Lrexsee/natives/clazz/ListViewAdapter;->mViews:[Landroid/view/View;

    aget-object v3, v3, p1

    invoke-virtual {v1, v3}, Landroid/widget/FrameLayout;->addView(Landroid/view/View;)V

    goto :goto_0
.end method
